package com.ddw.meedeeuh.shared.movie.database;

import java.io.File;

import com.ddw.meedeeuh.shared.io.PathUtils;

public abstract class MovieDBFactory {

	private static File DB_FILE = null;

	public static MovieDB create() {
		return create(getDbFile());
	}

	public static MovieDB create(File file) {
		if(file == null) {
			throw new IllegalArgumentException("The file parameter cannot be null");
		}

		return new MovieDBSQLite(file);
	}

	/**
	 * Gets the database file instance
	 * @return a file instance
	 */
	private static File getDbFile() {
		if(DB_FILE == null) {
			DB_FILE = new File(PathUtils.getCurrentDirectory(), "Movie.db");
		}
		return DB_FILE;
	}

}
